<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        
        
        
        <link rel="shortcut icon" href="./img/favicon.ico">

	<title>JavaBaas</title>

        <link href="./css/bootstrap-custom.min.css" rel="stylesheet">
        <link href="./css/font-awesome-4.0.3.css" rel="stylesheet">
        <link href="./css/base.css" rel="stylesheet">
        <link rel="stylesheet" href="./css/highlight.css">

        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
            <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
            <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->

        
    </head>

    <body class="homepage">

        <div class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">

        <!-- Collapsed navigation -->
        <div class="navbar-header">
            
            <!-- Expander button -->
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            

            <!-- Main title -->
            <a class="navbar-brand" href=".">JavaBaas</a>
        </div>

        <!-- Expanded navigation -->
        <div class="navbar-collapse collapse">
            
                <!-- Main navigation -->
                <ul class="nav navbar-nav">
                
                
                    <li class="active">
                        <a href=".">主页</a>
                    </li>
                
                
                
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">功能概述 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                        
                            
<li >
    <a href="overview/Object/">数据存储</a>
</li>

                        
                        </ul>
                    </li>
                
                
                
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">用户手册 <b class="caret"></b></a>
                        <ul class="dropdown-menu">
                        
                            
<li >
    <a href="commandline/">命令行工具</a>
</li>

                        
                            
<li >
    <a href="restapi/">REST API</a>
</li>

                        
                        </ul>
                    </li>
                
                
                
                    <li >
                        <a href="download/">下载</a>
                    </li>
                
                
                </ul>
            

            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a href="#" data-toggle="modal" data-target="#mkdocs_search_modal">
                        <i class="fa fa-search"></i> Search
                    </a>
                </li>
                
                    <li class="disabled">
                        <a rel="next" >
                            <i class="fa fa-arrow-left"></i> Previous
                        </a>
                    </li>
                    <li >
                        <a rel="prev" href="overview/Object/">
                            Next <i class="fa fa-arrow-right"></i>
                        </a>
                    </li>
                
                
            </ul>
        </div>
    </div>
</div>

        <div class="container">
            
                <div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
    <ul class="nav bs-sidenav">
    
        <li class="main active"><a href="#javabaas">JavaBaas</a></li>
        
            <li><a href="#_1">主要功能</a></li>
        
            <li><a href="#_2">快速上手</a></li>
        
            <li><a href="#_10">系统架构图</a></li>
        
    
    </ul>
</div></div>
                <div class="col-md-9" role="main">

<h1 id="javabaas">JavaBaas</h1>
<p>JavaBaas是基于Java语言开发的移动客户端后台开发框架，其核心设计目标是实现移动客户端的后台结构化数据存储、物理文件存储、消息推送等功能。极大的降低移动客户端的后台开发难度，实现快速开发。</p>
<p>项目地址：<a href="http://git.oschina.net/staryet/JavaBaas">git@osc</a></p>
<p>技术讨论群：479167886</p>
<h2 id="_1">主要功能</h2>
<ul>
<li>基于文档数据库的结构化数据存储</li>
<li>基于ACL的权限管理机制</li>
<li>用户系统</li>
<li>基于云存储的物理文件存储</li>
<li>消息推送</li>
</ul>
<h2 id="_2">快速上手</h2>
<h3 id="_3">相关环境</h3>
<h4 id="jdk">JDK</h4>
<p>JavaBaas基于最新的JDK1.8编写，编译及运行需要安装JDK1.8环境。</p>
<h4 id="mongodb">MongoDB</h4>
<p>JavaBaas使用mongoDB作为数据库存储，需要配置mongoDB数据库环境。</p>
<p>在<code>src/main/resources/application.properties</code>中配置数据库连接信息。</p>
<pre><code>spring.data.mongodb.host = localhost
spring.data.mongodb.port = 27017
spring.data.mongodb.database = baas
</code></pre>

<h4 id="redis">Redis</h4>
<p>JavaBaas使用Redis作为缓存引擎，需要配置Redis数据库环境。
在<code>src/main/resources/application.properties</code>中配置连接信息。</p>
<pre><code>spring.redis.host = localhost
spring.redis.port = 6379
</code></pre>

<h3 id="_4">构建</h3>
<p>JavaBaas使用Maven进行构建，在根目录中使用<code>mvn package</code>即可完成构建。</p>
<p>构建成功后会出现如下提示信息（截取部分信息）：</p>
<pre><code class="java">[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ baas ---
[INFO] Building jar: /target/baas.jar
[INFO] -----------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] -----------------------------------------------------------
</code></pre>

<h3 id="_5">配置</h3>
<h4 id="_6">服务器地址</h4>
<p>在某些情况下JavaBaas需要接受外部系统回调请求，因此需要配置系统部署服务器的ip地址。（本地测试时可使用127.0.0.1代替，生产环境需配置公网ip地址。）</p>
<p>例如，在<code>src/main/resources/application.properties</code>中配置当前服务器ip信息。</p>
<pre><code>host = http://58.132.171.126/
</code></pre>

<h4 id="_7">七牛云存储</h4>
<p>为了使用七牛云存储作为物理文件存储引擎，需要配置七牛云存储相关信息。
在<code>src/main/resources/application.properties</code>中配置以下信息。</p>
<pre><code>qiniu.ak = 七牛云存储的帐号ak
qiniu.sk = 七牛云存储的帐号sk
qiniu.bucket = bucket名称
qiniu.file.host = bucket的存储域名
</code></pre>

<h3 id="_8">初始化</h3>
<p>构建完成后，在/target目录中找到构建成功的jar文件。首次运行需要对系统进行初始化操作，以完成系统内建类的创建（用户、文件等）。</p>
<p>执行以下命令初始化并启动系统（jar包名称以实际生成名称为准）：</p>
<p><code>java -jar baas.jar init</code></p>
<p>看到以下信息，表明系统启动成功。</p>
<pre><code>INFO 7708 --- [main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
INFO 7708 --- [main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
INFO 7708 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
INFO 7708 --- [main] ac.beiwo.baas.Main                       : Started Main in 3.795 seconds
INFO 7708 --- [main] ac.beiwo.baas.admin.service.InitService  : 系统初始化成功.
</code></pre>

<h3 id="_9">运行</h3>
<p>系统初始化成功后，再次运行无需再加init参数，否则系统将重新初始化并清除内建信息。再次运行只需运行jar包即可（jar包名称以实际生成名称为准）：</p>
<p><code>java -jar baas.jar</code>
看到以下信息，表明系统启动成功。</p>
<pre><code>INFO 7708 --- [main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
INFO 7708 --- [main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
INFO 7708 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
INFO 7708 --- [main] ac.beiwo.baas.Main                       : Started Main in 3.795 seconds
</code></pre>

<h2 id="_10">系统架构图</h2>
<p><img alt="Screenshot" src="./img/baasoverview.png" /></p></div>
            
        </div>

        <footer class="col-md-12">
            <hr>
            
            <p>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</p>
        </footer>

        <script src="./js/jquery-1.10.2.min.js"></script>
        <script src="./js/bootstrap-3.0.3.min.js"></script>
        <script src="./js/highlight.pack.js"></script>
        <script>var base_url = '.';</script>
        <script data-main="./mkdocs/js/search.js" src="./mkdocs/js/require.js"></script>
        <script src="./js/base.js"></script>

        <div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="Search Modal" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title" id="exampleModalLabel">Search</h4>
                    </div>
                    <div class="modal-body">
                        <p>
                            From here you can search these documents. Enter
                            your search terms below.
                        </p>
                        <form role="form">
                            <div class="form-group">
                                <input type="text" class="form-control" placeholder="Search..." id="mkdocs-search-query">
                            </div>
                        </form>
                        <div id="mkdocs-search-results"></div>
                    </div>
                    <div class="modal-footer">
                    </div>
                </div>
            </div>
        </div>

    </body>
</html>

<!--
MkDocs version : 0.14.0
Build Date UTC : 2015-10-16 09:17:29.845891
-->
